package leetcode.editor.template.dp.bag;

public class BagTest3 {
    public static void main(String[] args) {
        int[] weight = {1, 3, 4};
        int[] value = {15, 20, 30};
        int bagsize = 4;
        testweightbagproblem(weight, value, bagsize);
    }

    public static void testweightbagproblem(int[] weight, int[] value, int bagsize) {
        int[] dp = new int[bagsize + 1];
        for (int i = 0; i < weight.length; i++) {
            for (int j = weight[i]; j <= bagsize; j++) {
                dp[j] = Math.max(dp[j], dp[j - weight[i]] + value[i]);
            }
        }
        // 打印dp数组
    }
}
